<?
/**
  mysql数据库操作类
**/


class  Mysql_Cls 
{
	
	function __construct($mysqlConfig)
	{
		$this->connection($mysqlConfig);
	}

	function connection($mysqlConfig)
	{
		$host 	  = $mysqlConfig['host']  ;
		$username = $mysqlConfig['username'];
		$pwd	  = $mysqlConfig['pwd'];
		$this->rs = mysql_connect($host, $username, $pwd) or die('mysql connection error :'.mysql_error());
		$db 	  = $mysqlConfig['db'];
		mysql_query("set names utf8");
		mysql_select_db($db, $this->rs) or die(mysql_error());
	}

	function query($sql)
	{
		$this->queryRs = mysql_query($sql, $this->rs) or die('mysql query erro:'.mysql_error());
		return $this->queryRs;
	}

	function fetch_array()
	{
		return mysql_fetch_array($this->queryRs);
	}
}
?>
